<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.wqr.pojo.*" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html>
<html lang="en">
<head>
<title>我的菜单</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="Staple Food Responsive web template, Bootstrap Web Templates, Flat Web Templates, Android Compatible web template, 
	SmartPhone Compatible web template, free WebDesigns for Nokia, Samsung, LG, Sony Ericsson, Motorola web design" />
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<!-- Custom Theme files -->
<link href="css/bootstrap.css" type="text/css" rel="stylesheet" media="all">
<link href="css/style.css" type="text/css" rel="stylesheet" media="all">  
<link href="css/font-awesome.css" rel="stylesheet"> <!-- font-awesome icons --> 
<link rel="stylesheet" href="css/owl.carousel.css" type="text/css" media="all"/> <!-- Owl-Carousel-CSS -->
<!-- //Custom Theme files --> 
<!-- js -->
<script src="js/jquery-2.2.3.min.js"></script>  
<!-- //js -->
<!-- web-fonts -->   
<link href="http://fonts.googleapis.com/css?family=Berkshire+Swash" rel="stylesheet"> 
<link href="http://fonts.googleapis.com/css?family=Yantramanav:100,300,400,500,700,900" rel="stylesheet">
<!-- //web-fonts -->
</head>
<body> 
	<!-- banner -->
	<div class="banner about-w3bnr">
		<!-- header -->
		<%@ include file="../jsp/userHeader2.jsp" %>
		<!-- //header-end --> 
		<!-- banner-text -->
		<div class="banner-text">	
			<div class="container">
				<h2>Delicious food from the <br> <span>
				最好的美食.</span>
				</h2> 
			</div>
		</div>
	</div>
	<!-- //banner -->    
	<!-- breadcrumb -->  
	<div class="container">	
		<ol class="breadcrumb w3l-crumbs">
			<li><a href="${pageContext.request.contextPath}/userIndex.action"><i class="fa fa-home"></i> 主页</a></li> 
			<li class="active">菜单</li>
		</ol>
	</div>
	<!-- //breadcrumb -->
	<!-- products -->
	<div class="products">	 
		<div class="container">
			<div class="col-md-9 product-w3ls-right"> 
				<div class="product-top">
					<h4>我的菜谱</h4>
					<div class="clearfix"> </div>
				</div>
				<div class="products-row" >
					<div id="resultAll">
					<c:forEach items="${itemList}" var="delicious" >
					<div class="col-xs-6 col-sm-4 product-grids">
						<div class="flip-container">
							<div class="flipper agile-products">
								<div class="front"> 
									<img src="/pic/${delicious.deliciousPicture}" class="img-responsive" alt="IMG">
									<div class="agile-product-text">              
										<h5><font style="vertical-align: inherit;">
										<font style="vertical-align: inherit;">${delicious.deliciousName}</font></font></h5>  
									</div> 
								</div>
								<div class="back">
									<h4><font style="vertical-align: inherit;">${delicious.deliciousName}</font></h4>
									<p><font style="vertical-align: inherit;">BY:  ${delicious.userName}</font></p>
									<p><font style="vertical-align: inherit;">评分:  ${delicious.deliciousScore}</font></p>
									<p><font style="vertical-align: inherit;">所属频道:  ${delicious.channelName}</font></p>
									<form action="#" method="post">
										<input type="hidden" name="cmd" value="_cart">
										<input type="hidden" name="add" value="1"> 
										<input type="hidden" name="w3ls_item" value="Fish salad"> 
										<input type="hidden" name="amount" value="3.00"> 
										<!-- <button type="submit" class="w3ls-cart pw3ls-cart"><i class="fa fa-cart-plus" aria-hidden="true"></i><font style="vertical-align: inherit;"><font style="vertical-align: inherit;"> 添加到心愿单</font></font></button>
										<span class="w3-agile-line"> </span> -->
										<a href="${pageContext.request.contextPath}/showUserDeliciousPractice.action?deliciousId=${delicious.deliciousId}" 
										data-toggle="modal"><font style="vertical-align: inherit;">
										<font style="vertical-align: inherit;">了解更多</font></font></a>
										<a href="javascript:void(0);" onclick="deleteUserDeliciousPractice(${delicious.deliciousId})"  
										data-toggle="modal"><font style="vertical-align: inherit;">
										<font style="vertical-align: inherit;">删除</font></font></a>
										<a href="${pageContext.request.contextPath}/userModifyDelicious.action?deliciousId=${delicious.deliciousId}" 
										data-toggle="modal"><font style="vertical-align: inherit;">
										<font style="vertical-align: inherit;">修改</font></font></a>
									</form>
								</div>
							</div>
						</div> 
					</div>
					</c:forEach>
					</div>
					<div id="result"></div>
					
					<div class="clearfix"> </div>
				</div>
			</div>
			<div class="col-md-3 rsidebar">
				
				<div class="related-row">
					<h4>管理</h4>
					<ul>
						<li><a href="${pageContext.request.contextPath}/userAdddDelicious.action">发布菜谱</a></li>
					</ul>
					<br>
					<h4>可能感兴趣的小技巧</h4>
					<ul>
						<li><a href="https://kitchenstories.io/zh/xiao-tie-shi">如何磨刀</a></li>
					</ul>
					
				</div>
			</div>
			<div class="clearfix"> </div> 
		</div>
	</div>
	<!-- //products --> 
	
	<!-- modal --> 
	<div class="modal video-modal fade" id="myModal1" tabindex="-1" role="dialog" aria-labelledby="myModal1">
		
	</div> 
	<!-- //modal -->
	<!-- footer -->
	<%@ include file="../jsp/userFooter.jsp" %>
	<!-- //footer -->   
	<!-- cart-js -->
	<script src="js/minicart.js"></script>
	<script>
        w3ls.render();

        w3ls.cart.on('w3sb_checkout', function (evt) {
        	var items, len, i;

        	if (this.subtotal() > 0) {
        		items = this.items();

        		for (i = 0, len = items.length; i < len; i++) { 
        		}
        	}
        });
    </script>  
	<!-- //cart-js --> 
	
	<!-- Owl-Carousel-JavaScript -->
	<script src="js/owl.carousel.js"></script>
	<script>
		$(document).ready(function() {
			//searchAllDelicious();
			
			$("#owl-demo").owlCarousel ({
				items : 3,
				lazyLoad : true,
				autoPlay : true,
				pagination : true,
			});
		});
		function deleteUserDeliciousPractice(deliciousId){
			var user_json = {  
		            "deliciousId":deliciousId
		            }      
			//js对象转换成JSON字符串  
		    var jason_str = JSON.stringify(user_json);  
			if(confirm("确定要删除么？")){
				//Ajax发送数据给后台  
		        $.ajax({  
		            url :"${pageContext.request.contextPath }/deleteDelicious.action",   
		            cache : true,  
		            type : "post",  
		            datatype : "json",  
		            contentType : "application/json; charset=utf-8",  
		            data : jason_str,  
		            success : function (data){  
		             	//返回空值  
		                if(data == 0){  
		                    alert("删除出现未知错误！");  
		                } else{  //存在该用户  
		                	alert("删除成功！");
		                    }
		                window.location.reload();
		                }
		        	
		        });  
			}
		}	
	</script>
	<!-- //Owl-Carousel-JavaScript -->  	
	<!-- the jScrollPane script -->
	<script type="text/javascript" src="js/jquery.jscrollpane.min.js"></script>
	<script type="text/javascript" id="sourcecode">
		$(function()
		{
			$('.scroll-pane').jScrollPane();
		});
	</script>
	<!-- //the jScrollPane script -->
	<script type="text/javascript" src="js/jquery.mousewheel.js"></script> <!-- the mouse wheel plugin --> 
	<!-- start-smooth-scrolling -->
	<script src="js/SmoothScroll.min.js"></script>  
	<script type="text/javascript" src="js/move-top.js"></script>
	<script type="text/javascript" src="js/easing.js"></script>	
	<script type="text/javascript">
			jQuery(document).ready(function($) {
				$(".scroll").click(function(event){		
					event.preventDefault();
			$('html,body').animate({scrollTop:$(this.hash).offset().top},1000);
				});
			});
	</script>
	<!-- //end-smooth-scrolling -->	  
	<!-- smooth-scrolling-of-move-up -->
	<script type="text/javascript">
		$(document).ready(function() {
			getService();
			$().UItoTop({ easingType: 'easeOutQuart' });
		});
		function getService() {
			var str = "<option value=''>受欢迎的菜谱</option>";
			//$("select[name=txtChannelId]").empty();      //清空  
			$("#agileinfo_search").val(null);
			//Ajax发送数据给后台  
		    $.ajax({  
		        url :"${pageContext.request.contextPath }/allChannel.action",   
		        cache : true,  
		        type : "post",  
		        datatype : "json",  
		        contentType : "application/json; charset=utf-8",  
		        data : "",  
		        success : function (data){ 
		         	 for (var i in data) { 
		         		 str += "<li class='subitem1'><a href=''>Panzanella</a></li>"
		         		
		       		     str += "<option value='"+ data[i].channelId + "'>" +data[i].channelName+"</option>";
			       	  } 
			       	  $("#agileinfo_search").prepend(str);
			         },  
			         error: function (msg) {  
			             alert("出错了！");  
			         }  
		    });  
		}
	</script>
    <script src="js/bootstrap.js"></script>
</body>
</html>
